Note: This tutorial assumes you have completed previous tutorial siemens_cp1616/Tutorials/Introduction to siemens_cp1616. |
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
CP1616 in IO Device mode - Configuration
Description: This tutorial teaches you how to configure PROFINET communication with CP1616 in IO Device mode. Simple TIA Portal example project using S7-1200 PLC is includedKeywords: SIEMENS, PROFINET, CP1616, IO Device, Configuration
Tutorial Level: INTERMEDIATE
Next Tutorial: siemens_cp1616/Tutorials/CP1616 in IO Device mode - User Node
TIA Portal configuration
Full archive of tutorial TIA Portal project is available here. (Please use "Project/Retrieve" option to extract the files)
Lets assume that we have successfully configured PROFINET network in TIA Portal:
and we would like to transfer following data between IO Device (CP1616) and IO Controller (PLC):
In order to achieve that, configuration of Transfer areas needs to be passed into ROS wrapper by .yaml file first.
Yaml file
For "Transfer areas" as shown in picture above, appropriate .yaml file will have the following structure:
- label: module_DAP type: init size: 0 slot: 1 modId: 0x19 subslotId: 0x10001 topic: none - label: PLC_output_byte type: output size: 1 slot: 2 modId: 0x22 subslotId: 0x01 topic: plc_output_byte_topic - label: PLC_input_byte type: input size: 1 slot: 3 modId: 0x21 subslotId: 0x01 topic: plc_input_byte_topic - label: PLC_output_real type: output size: 4 slot: 4 modId: 0x25 subslotId: 0x01 topic: plc_output_real_topic - label: PLC_input_real type: input size: 4 slot: 5 modId: 0x24 subslotId: 0x01 topic: plc_input_real_topic - label: PLC_output_byte_array type: output size: 8 slot: 6 modId: 0x3D subslotId: 0x01 topic: plc_output_byte_array_topic - label: PLC_input_byte_array type: input size: 8 slot: 7 modId: 0x3C subslotId: 0x01 topic: plc_input_byte_array_topic - label: PLC_bidirect type: bidirect size: 1 slot: 8 modId: 0x20 subslotId: 0x01 topic: plc_bidirect
Initialization DAP module needs to be added to every IO Device configuration with parameters according to generated gsdxml file. Type (input/output) is always assessed from IO Controller point of view. In IO Device mode it is also possible to configure bi-directional modules/slots/transfer areas as shown in the example above (last module).
Launch file
.yaml filepath needs to be uploaded on ROS Parameter server. User node can also be added to the launch file here:
<launch> <!-- Load yaml config filepath on rosparam server --> <param name="filepath" value="$(find siemens_cp1616_io_device_tutorial)/config/siemens_cp1616_io_device_tutorial_config.yaml"/> <!-- Wrapper node --> <node name="siemens_cp1616_io_device_wrapper" pkg="siemens_cp1616" type="io_device_wrapper" output="screen" /> <!-- User node --> <node name="siemens_cp1616_io_device_tutorial_node" pkg="siemens_cp1616_io_device_tutorial" type="siemens_cp1616_io_device_tutorial_node" output="screen" /> </launch>
After completing configuration we can move to interfacing PROFINET from code and start creating simple ROS node.
Next tutorial: CP1616 in IO Device mode - User node